#ifndef __MESON_HPP__
#define __MESON_HPP__

#include <string>
#include <vector>
#include <stdexcept>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>

namespace meson {

  struct Error: public std::runtime_error {
    Error (const std::string &what): std::runtime_error(what) {}
  };



    ~Node();

    template <typename Hook>
    void hook(const std::string &peer, const Hook &hook) {
    }

    void hookObject(const std::string &peer, HookObject *hook) {
    }

    void unhook(const std::string &peer) {
    }

    template <typename Iterator>
    void send(const Iterator &begin, const Iterator &end, const std::string &peer) {
    }

    void timer();

    void run();    

  };











  typedef vector<char> Buffer;


  struct ChannelBase {
    event evt;
    sockaddr_in addr;

    virtual void invoke(const Buffer::iterator &begin, 
			const Buffer::iterator &end, 
			const std::string &node) = 0;
  };

  template <typename Iterator>
  struct Channel: public ChannelBase {
    typedef 

    Channel(const 

    void invoke(const Buffer::iterator &begin,
		const Buffer::iterator &end,
		const std::string &node)
  };


#endif
